package main

import (
	"log"
	"net"
	"zinxp/znet"
)

func main()  {
	conn,err := net.Dial("tcp","0.0.0.0:7878")
	if err != nil {
		log.Println("client dial err ",err)
		return
	}
	
	dp := znet.NewDataPack()
	msg1 := &znet.Message{
		Id:      0,
		DataLen: 5,
		Data:    []byte{'h','e','l','l','o'},
	}
	senddata1,err := dp.Pack(msg1)
	if err != nil{
		log.Println("client pack msg1 error ",err)
		return
	}
	msg2 := &znet.Message{
		Id:      1,
		DataLen: 7,
		Data:    []byte("world!!!!!!"),
	}
	senddata2,err := dp.Pack(msg2)
	if err != nil {
		log.Println("client pack msg2 error ",err)
		return
	}
	
	senddata1 =append(senddata1,senddata2...)
	conn.Write(senddata1)
}
